<template>
  <div id="header">
    <div id="content">
      <!-- logo和搜索 -->
      <div class="logo">
        <span>CuiCui</span>
        <!-- <div id="search">
          <input type="text" v-model="search" placeholder="search..." />
        </div> -->
      </div>
      <!-- 导航 -->
      <div class="nav">
        <Nav></Nav>
      </div>
      <!-- 登录 -->
      <div class="login">
        <!-- <Login></Login> -->
		<div id="search">
		  <input type="text" v-model="search" placeholder="请输入关键词..." />
		  <button @click="handleSearch">搜索</button>
		</div>
      </div>
    </div>
  </div>
</template>
<script>
import Nav from "./Nav";
import Login from "./Login";
export default {
  name: "Header",
  data() {
    return {
      search: ""
    };
  },
  components: {
    Nav,
    Login
  },
  methods:{
    handleSearch(){
      if(!this.search){
        this.$message.warning("请输入关键词！");
        return false;
      }
      this.$router.push({path:"/search",query:{keyword:this.search,currentPage:1}})
    }
  }
};
</script>  

<style lang="stylus" scoped>
#header {
  width: 100%;
  height: 60px;
  // background: #404756;
  background:#fff;
  #content {
    max-width: 1200px;
    margin: 0 auto;
    display: flex;
    justify-content: space-between;

    .logo {
      line-height: 60px;
      color: #c0c2c7;

      span {
        font-family: STKaiti;
        font-size: 18px;
        display: inline-block;
        float: left;
      }
    }
	.nav{
		flex:1;
		margin:0 20px;
	}
	.login{
		line-height:60px;
		#search {
		  float: left;
		  width: 260px;
		  margin-left: 20px;
		  height: 35px;
		  button{
			  width:60px;
			  height:35px;
			  cursor:pointer;
			  color:#666;
			  background:#e6e6e6;
			  border:none;
			  outline:none;
			  font-size:12px;
		  }
		  input {
		    // background: #616673;
		    border: none;
			border:1px solid #e6e6e6;
		    height: 35px;
		    width: 200px;
		    color: #666;
		    padding: 0 10px;
		    box-sizing: border-box;
		    outline: none;
		  }
		
		  input::-webkit-input-placeholder {
		    color: #c0c2c7;
		  }
		
		  input:-ms-input-placeholder {
		    color: #c0c2c7;
		  }
		
		  input::-moz-placeholder {
		    color: #c0c2c7;
		  }
		}
	}
  }
}
</style>